package code.structure.module.storage.manager
{
	import code.structure.module.configs.ConfigModel;
	import code.structure.module.storage.data.StorageData;
	
	import flash.utils.Dictionary;

	/**
	 *杂物间管理器 
	 * @author Yuri
	 * 
	 */
	public class HovelManager
	{
		private var _dic:Dictionary = new Dictionary();
		private var _configModel:ConfigModel;
		public function HovelManager(configModel:ConfigModel)
		{
			_configModel = configModel;
		}
		
		public function parser(d:Object):void
		{
			var hD:StorageData = new StorageData();
			hD.id = d.id;
			hD.num = d.num;
			hD.configData = _configModel.analysisItem.getItemConfigDataById(hD.id);
			_dic[hD.id] = hD;
		}
		
		public function addStorageData(id:int,num:int):void
		{
			var hD:StorageData = _dic[id];
			if(!hD)
			{
				hD = new StorageData();
				hD.id = id;
				hD.configData = _configModel.analysisItem.getItemConfigDataById(id);
			}
			hD.num += num;
		}
	}
}